package com.cy.controller;



import com.cy.bfzcommons.pojo.Category;
import com.cy.bfzcommons.service.CategoryService;
import com.cy.bfzcommons.web.util.JsonResult;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/categoryVue")

public class CategoryControllerVue {
    @Autowired
    private CategoryService categoryService;


    @GetMapping
    public JsonResult findCategory(){
        List<Category> list = categoryService.getCategory(1);
        return JsonResult.ok(list);
    }


    @GetMapping("/categoryList/{level}")
    public JsonResult selectCategoryLevel(@ApiParam(name="level",value="菜单级别",required=true)@PathVariable Integer level){
        List<Category> list = categoryService.getCategory(level);
        return JsonResult.ok(list);
    }
}
